package com.rran.study.chat.server.dto;

import lombok.Data;

/**
 * @author yy
 * @Type Response.java
 * @Desc
 * @date 2020/8/10 15:01
 */
@Data
public class Response<T> {

    private String description = "SUCCESS";
    private String code;
    private T data;

    public Response() {
    }


    public Response(T data) {
        this.data = data;
    }
    public static <T> Response<T> success(T data) {
        return result(data, "000000", "SUCCESS");
    }
    public static Response success() {
        return success((Object)null);
    }
    public static <T> Response<T> result(T data, String code, String msg) {
        Response<T> response = new Response();
        response.setCode(code);
        response.setData(data);
        response.setDescription(msg);
        return response;
    }
}
